/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package view;
import controler.Controleur;

/**
 *
 * @author Vaïk
 */
public class FrameNewPartie extends javax.swing.JDialog {

    /**
     * Creates new form FrameNewPartie
     */
    public FrameNewPartie(java.awt.Frame parent, boolean modal, Controleur c) {
        super(parent, modal);
        initComponents();
        controleur = c;
        setVisible(true);
    }
    
    public FrameNewPartie(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        setVisible(true);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        JLabel1 = new javax.swing.JLabel();
        rb2j = new javax.swing.JRadioButton();
        rb3j = new javax.swing.JRadioButton();
        rb4j = new javax.swing.JRadioButton();
        AnnulerB = new javax.swing.JButton();
        validerB = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        JLabel1.setText("Nombre de joueurs :");

        buttonGroup1.add(rb2j);
        rb2j.setSelected(true);
        rb2j.setText("2");

        buttonGroup1.add(rb3j);
        rb3j.setText("3");

        buttonGroup1.add(rb4j);
        rb4j.setText("4");

        AnnulerB.setText("Annuler");
        AnnulerB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AnnulerBActionPerformed(evt);
            }
        });

        validerB.setText("Valider");
        validerB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                validerBActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(JLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(rb4j)
                            .addComponent(rb3j)
                            .addComponent(rb2j)))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(AnnulerB)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(validerB)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(JLabel1)
                    .addComponent(rb2j))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(rb3j)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(rb4j)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(AnnulerB)
                    .addComponent(validerB))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    private void AnnulerBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AnnulerBActionPerformed
        // TODO add your handling code here:
        dispose();
    }//GEN-LAST:event_AnnulerBActionPerformed

    private void validerBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_validerBActionPerformed
        // TODO add your handling code here:
        setVisible(false);
        controleur.choixDesJoueurs(this);
    }//GEN-LAST:event_validerBActionPerformed

    

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton AnnulerB;
    private javax.swing.JLabel JLabel1;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JRadioButton rb2j;
    private javax.swing.JRadioButton rb3j;
    private javax.swing.JRadioButton rb4j;
    private javax.swing.JButton validerB;
    // End of variables declaration//GEN-END:variables

    private Controleur controleur;

    /**
     * @return the controleur
     */
    public Controleur getControleur() {
        return controleur;
    }
    
    public javax.swing.JButton getAnnulerB()
    {
        return AnnulerB;
    }
    
    public javax.swing.JLabel getJLabel1()
    {
        return JLabel1;
    }
    
    public javax.swing.ButtonGroup getButtonGroup1()
    {
        return buttonGroup1;
    }
    
    public javax.swing.JRadioButton getRb2j()
    {
        return rb2j;
    }
    
    public javax.swing.JRadioButton getRb3j()
    {
        return rb3j;
    }
    
    public javax.swing.JRadioButton getRB4J()
    {
        return rb4j;
    }
}
